package com.steakliu.springasync.scheduler;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.FutureTask;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2022-09-19  21:26
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */

public class TimerTest {
    public static void main(String[] args) {

        Timer timer = new Timer();
        DemoTask demoTask = new DemoTask();
        //timer.scheduleAtFixedRate(demoTask, 3000, 1000);
        timer.schedule(demoTask, 2000);
        //timer.schedule(demoTask, new Date());

    }

    private static class DemoTask extends TimerTask{
        @Override
        public void run() {
            System.out.println("执行任务");
        }
    }
}
